
#ifndef   __EXTERNAL_EEPROM_MAPING__
#define   __EXTERNAL_EEPROM_MAPING__

/* Entry - type of write data */

typedef struct
{
		unsigned int  DirectioryName;  		/* Address of Directory */
		unsigned int  EntryCount;  			/* Count of Entrys in the Directory (max. size of Directory) */
		unsigned char EntryNameSize;	 		/* Size of Entry Name; use this parameter for Entry search in the Directory */
		unsigned char EntrySize;			  	/* Entry size in bytes */
		
}EX_DIRECTORY_PROPERTIES;

#define   RECORD_CUSTOMER_SIZE	15

   /* OWNERS or USERS List each entry (see typedef struct RECORD_CUSTOMER) of 8 bytes*/
/* Owners maximum == 100 */
#define   EX_ADDR_LIST_OWNERS						0x0100 
#define   EX_LIST_OWNERS_COUNT_MAX				100	

/* All Users */
#define   EX_LIST_USERS_COUNT_MAX				1000

 /* users group_1 maximum == 300 */
//#define   EX_ADDR_LIST_USERS_GROUP_1			( EX_ADDR_LIST_OWNERS + EX_LIST_OWNERS_COUNT_MAX * sizeof(RECORD_CUSTOMER) )
#define   EX_ADDR_LIST_USERS_GROUP_1			( EX_ADDR_LIST_OWNERS + EX_LIST_OWNERS_COUNT_MAX * RECORD_CUSTOMER_SIZE)//sizeof(RECORD_CUSTOMER) )
#define   EX_LIST_USERS_GROUP_1_COUNT_MAX		100

 /* users group_2 maximum == 300 */
//#define   EX_ADDR_LIST_USERS_GROUP_2			( EX_ADDR_LIST_USERS_GROUP_1 + EX_LIST_USERS_GROUP_1_COUNT_MAX * sizeof(RECORD_CUSTOMER) )
#define   EX_ADDR_LIST_USERS_GROUP_2			( EX_ADDR_LIST_USERS_GROUP_1 + EX_LIST_USERS_GROUP_1_COUNT_MAX * RECORD_CUSTOMER_SIZE )
#define   EX_LIST_USERS_GROUP_2_COUNT_MAX		100

 /* users group_2 maximum == 300 */
 //#define   EX_ADDR_LIST_USERS_GROUP_3			( EX_ADDR_LIST_USERS_GROUP_2 + EX_LIST_USERS_GROUP_2_COUNT_MAX * sizeof(RECORD_CUSTOMER) )
#define   EX_ADDR_LIST_USERS_GROUP_3			( EX_ADDR_LIST_USERS_GROUP_2 + EX_LIST_USERS_GROUP_2_COUNT_MAX * RECORD_CUSTOMER_SIZE )
#define   EX_LIST_USERS_GROUP_3_COUNT_MAX		100

//#define   EX_ADDR_LIST_USERS_GROUP_4			( EX_ADDR_LIST_USERS_GROUP_3 + EX_LIST_USERS_GROUP_3_COUNT_MAX * sizeof(RECORD_CUSTOMER) )
#define   EX_ADDR_LIST_USERS_GROUP_4			( EX_ADDR_LIST_USERS_GROUP_3 + EX_LIST_USERS_GROUP_3_COUNT_MAX * RECORD_CUSTOMER_SIZE )
#define   EX_LIST_USERS_GROUP_3_COUNT_MAX		100

/* 300 + 300 + 300 + 300 = 1200;  2400 - 1200 = 1200 */


/* Inputs Descriptors maximum == 40 */
#define   EX_ADDR_INPUTS_DESCRIPTORS			( EX_ADDR_LIST_USERS_GROUP_1 + EX_LIST_USERS_COUNT_MAX * sizeof(RECORD_CUSTOMER) ) 
#define   EX_INPUTS_DESCRIPTORS_COUNT_MAX		40				

         
/* #define   EX_ADDR_LIST_RF_REMOTE	(EX_ADDR_INPUTS_DESCRIPTORS+EX_INPUTS_DESCRIPTORS_COUNT_MAX * sizeof(INPUTS_DESCRIPTOR)) */
/* #define   EX_LIST_RF_REMOTE_COUNT_MAX			100 */

/* #define   EX_ADDR_RF_INPUTS_DESCRIPTORS	(EX_ADDR_LIST_RF_REMOTE + EX_LIST_RF_REMOTE_COUNT_MAX * sizeof(RECORD_RF_REMOTE)) */
/* #define   EX_RF_INPUTS_DESCRIPTORS_COUNT_MAX	20 */


#define   EX_ADDR_COMMAND_MACROS (EX_ADDR_INPUTS_DESCRIPTORS+EX_INPUTS_DESCRIPTORS_COUNT_MAX * sizeof(INPUTS_DESCRIPTOR))
#define   EX_LIST_COMMAND_MACROS_COUNT_MAX	100



//#define   EX_ADDR_FREE_SPACE	( EX_ADDR_INPUTS_DESCRIPTORS + EX_INPUTS_DESCRIPTORS_COUNT * sizeof(INPUTS_DESCRIPTOR))
//#define   EX_ADDR_FREE_SPACE	( EX_ADDR_LIST_RF_REMOTE + EX_LIST_RF_REMOTE_COUNT_MAX * sizeof(RF_REMOTE_RECORD))
//#define   EX_ADDR_FREE_SPACE (EX_ADDR_RF_INPUTS_DESCRIPTORS+EX_RF_INPUTS_DESCRIPTORS_COUNT_MAX*sizeof(RF_INPUT_DESCRIPTOR))
#define   EX_ADDR_FREE_SPACE (EX_ADDR_COMMAND_MACROS+EX_LIST_COMMAND_MACROS_COUNT_MAX*sizeof(COMMAND_MACRO))


/* #if EX_ADDR_FREE_SPACE == 0xFFFFFFFFUL */
/* #error	 EEPROM: No free space; */
/* #endif */

#endif

